home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / marxmenu.arc / NOVTRANS.MNU < prev    next >
Text File  |  1991-03-27  |  21KB  |  535 lines

  1. Comment
  2. ========================================================================
  3.  
  4. Novell to MarxMenu Translator:
  5.  
  6. Copyright 1989-90 By Computer Tyme * All rights reserved.
  7.  
  8. Usage: MARXMENU NOVTRANS <novell menu>
  9.  
  10. This program was written to translate Novell menus to MarxMenus. It is
  11. not an exact translation, but does the bulk of the work. It is up to you
  12. to edit the output file and tune the menu the way you want.
  13.  
  14. I have made no attempt to copy color information. I am not presenting
  15. selections in sorted order, but in the order in which they are defined.
  16.  
  17. The program creates a MarxMenu file names <menu>.TMP where <menu> is the
  18. name of your Novell menu file. Then it compiles <menu>.TMP into
  19. <menu>.MRX file that should be ready to run. If the menu needs to be
  20. altered, you will have to rename the <menu>.TMP file to a .MNU file and
  21. then you can work with it like any other MarxMenu source file.
  22.  
  23. ========================================================================
  24. EndComment
  25.  
  26. Var
  27.    NovLines Menus Tmp MenuPtr ChoicePtr CommandPtr LinePtr
  28.    BoxDim X Y Z VarNum PromptLine Out Cap InputAVar NovellFileName
  29.    MarxMenuFileName NovellTempFileName
  30.  
  31. ;------ Array Positions
  32.  
  33. Qualifier MenuName YPos XPos MenuColor MenuChoices
  34. Qualifier ChoiceName ChoiceCmd
  35.  
  36. Comment
  37. ========================================================================
  38.  
  39. This is the main body of the NovTrans Program.
  40.  
  41. ========================================================================
  42. EndComment
  43.  
  44. PreAmble
  45. PrepareFiles
  46. Header
  47. Parse
  48. WriteOutMenus
  49. WriteOutProcedures
  50. UseCommand Yes
  51. ClearScreenFirst No
  52. Execute 'MARXCOMP.EXE ' + MarxMenuFileName
  53.  
  54. Writeln
  55. Writeln 'Done!'
  56.  
  57. Comment
  58. ========================================================================
  59.  
  60. Subroutine area.
  61.  
  62. ========================================================================
  63. EndComment
  64.  
  65. ;----- Initilize Variables and Environment
  66.  
  67. Procedure PreAmble
  68.   ClearScreenOnExit Off
  69.   StandardIO
  70.   Writeln
  71.   NovellFileName = UpperCase(ParamStr(2))
  72.   Usage
  73. EndProc
  74.  
  75. ;------ Proper Usage Procedure
  76.  
  77. Procedure Usage
  78.   If NovellFileName = ''
  79.     Writeln('Usage: MarxMenu NovTrans <menu>')
  80.     Writeln('Converts Novell menus to MarxMenus.')
  81.     Writeln('Be sure to backup your original menus before running!!')
  82.     ExitMenu
  83.   EndIf
  84. EndProc
  85.  
  86. ;----- Create FileNames and open Files
  87.  
  88. Procedure PrepareFiles
  89.   If pos('.',NovellFileName) > 0
  90.     NovellFileName = left(NovellFileName,pred(pos('.',NovellFileName)))
  91.   EndIf
  92.  
  93.   NovellTempFileName = NovellFileName + '.MNU'
  94.   MarxMenuFileName = ForceExtension(NovellTempFileName,'TMP')
  95.  
  96.   ReadTextFile NovellTempFileName NovLines
  97.   Writeln 'Creating ' MarxMenuFileName
  98.  
  99.   FileAssign(Out,MarxMenuFileName)
  100.   FileCreate(Out)
  101. EndProc
  102.  
  103. ;----- Write out the MarxMenu Source Header
  104.  
  105. Procedure Header
  106.   FileWriteln(Out,'Comment')
  107.   FileWriteln(Out,'==========================================================')
  108.   FileWriteln(Out,'')
  109.   FileWriteln(Out,'This File was converted from a Novell Menu.')
  110.   FileWriteln(Out,'It should behave in a similar way to the original menu but')
  111.   FileWriteln(Out,'not necessarilly exactly the same. It will be close enough')
  112.   FileWriteln(Out,'for you to fine tune it the way you want.')
  113.   FileWriteln(Out,'')
  114.   FileWriteln(Out,'To add a choice to a menu simply create another array element' )
  115.   FileWriteln(Out,'to Choices, then add the appropiate Onkey statement.' )
  116.   FileWriteln(Out,'The menu will make the size adjustments accordinaly.' )
  117.   FileWriteln(Out,'  EX:' )
  118.   FileWriteln(Out,'      Choices[10] = "Print Console" ' )
  119.   FileWriteln(Out,'      ... ' )
  120.   FileWriteln(Out,'      ... ' )
  121.   FileWriteln(Out,'      OnKey "K" ')
  122.   FileWriteln(Out,'        PConsole ' )
  123.   FileWriteln(Out,'      ...' )
  124.   FileWriteln(Out,'' )
  125.   FileWriteln(Out," If you want to change the menu's center, pass the XY" )
  126.   FileWriteln(Out," coordinates to menu's  MakeBox( ) procedure." )
  127.   FileWriteln(Out,'   EX:' )
  128.   FileWriteln(Out,'     MakeBox( "Menu Header",10,10,CenterXY ) ' )
  129.   FileWriteln(Out,' This will cause the menu to center at Col 10, Row 10 ' )
  130.   FileWriteln(Out,'' )
  131.   FileWriteln(Out,'=========================================================')
  132.   FileWriteln(Out,'EndComment')
  133.   FileWriteln(Out,'')
  134.   FileWriteln(Out,';------' )
  135.   FileWriteln(Out,';- Create Variables')
  136.   FileWriteln(Out,';------' )
  137.   FileWriteln(Out,'Var')
  138.   FileWriteln(Out,'  VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"')
  139.   FileWriteln(Out,'  %NovVar1 %NovVar2 %NovVar3 %NovVar4 ')
  140.   FileWriteln(Out,'  %NovVar5 %NovVar6 %NovVar7 %NovVar8 %NovVar9' )
  141.   FileWriteln(Out,'  Choices' )
  142.   FileWriteln(Out,'  MenuTitle' )
  143.   FileWriteln(Out,'  StatusLineText' )
  144.   FileWriteln(Out,'  BackGroundFG     BackGroundBG' )
  145.   FileWriteln(Out,'  TitleBoxBorderFG TitleBoxBorderBG' )
  146.   FileWriteln(Out,'  TitleBoxInsideFG TitleBoxInsideBG' )
  147.   FileWriteln(Out,'  ClockColorFG     ClockColorBG' )
  148.   FileWriteln(Out,'  StatusLineFG     StatusLineBG' )
  149.   FileWriteln(Out,'  MenuInsideFG     MenuInsideBG' )
  150.   FileWriteln(Out,'  MenuHeaderFG     MenuHeaderBG' )
  151.   FileWriteln(Out,'  MenuBorderFG     MenuBorderBG' )
  152.   FileWriteln(Out,'  MenuVertLinesFG  MenuVertLinesBG' )
  153.   FileWriteln(Out,'  MenuInverseFG    MenuInverseBG' )
  154.   FileWriteln(Out,'  MenuCapColorFG   MenuCapColorBG' )
  155.   FileWriteln(Out,'' )
  156.   FileWriteln(Out,';------' )
  157.   FileWriteln(Out,';- Create Constants' )
  158.   FileWriteln(Out,';------' )
  159.   FileWriteln(Out,'Const' )
  160.   FileWriteln(Out,' CornerXY = 1' )
  161.   FileWriteln(Out,' CenterXY = 0' )
  162.   FileWriteln(Out,'' )
  163.   FileWriteln(Out,'  ;Here is where you add you own menu title and status line message' )
  164.   FileWriteln(Out,'MenuTitle      = "MarxMenu System" ' )
  165.   FileWriteln(Out,'StatusLineText = "(C) Copyright 1990 Computer Tyme * All rights reserved"' )
  166.   FileWriteln(Out,'' )
  167.   FileWriteln(Out,';------')
  168.   FileWriteln(Out,';- Select colors and prepare screen')
  169.   FileWriteln(Out,';------' )
  170.   FileWriteln(Out,'SavePosition On')
  171.   FileWriteln(Out,'')
  172.   FileWriteln(Out,'  ;This is where you can change the colors to suit your taste.')
  173.   FileWriteln(Out,'If ColorScreen')
  174.   FileWriteln(Out,'     ;Color ColorSet' )
  175.   FileWriteln(Out,'   BackGroundFG     = Cyan'   )
  176.   FileWriteln(Out,'   BackGroundBG     = Blue'   )
  177.   FileWriteln(Out,'   TitleBoxBorderFG = Blue'   )
  178.   FileWriteln(Out,'   TitleBoxBorderBG = Cyan'   )
  179.   FileWriteln(Out,'   TitleBoxInsideFG = Blue'   )
  180.   FileWriteln(Out,'   TitleBoxInsideBG = Cyan'   )
  181.   FileWriteln(Out,'   ClockColorFG     = Blue'   )
  182.   FileWriteln(Out,'   ClockColorBG     = Cyan'   )
  183.   FileWriteln(Out,'   StatusLineFG     = Black'  )
  184.   FileWriteln(Out,'   StatusLineBG     = Cyan'   )
  185.   FileWriteln(Out,'   MenuInsideFG     = Yellow' )
  186.   FileWriteln(Out,'   MenuInsideBG     = Blue'   )
  187.   FileWriteln(Out,'   MenuBorderFG     = Yellow' )
  188.   FileWriteln(Out,'   MenuBorderBG     = Blue'   )
  189.   FileWriteln(Out,'   MenuHeaderFG     = White'    )
  190.   FileWriteln(Out,'   MenuHeaderBG     = Blue'   )
  191.   FileWriteln(Out,'   MenuVertLinesFG  = Green'  )
  192.   FileWriteln(Out,'   MenuVertLinesBG  = Blue'   )
  193.   FileWriteln(Out,'   MenuInverseFG    = White'  )
  194.   FileWriteln(Out,'   MenuInverseBG    = Red'    )
  195.   FileWriteln(Out,'   MenuCapColorFG   = White'  )
  196.   FileWriteln(Out,'   MenuCapColorBG   = Blue'  )
  197.   FileWriteln(Out,'else')
  198.   FileWriteln(Out,'     ;Monchrome ColorSet' )
  199.   FileWriteln(Out,'   BackGroundFG     = White'  )
  200.   FileWriteln(Out,'   BackGroundBG     = Black'  )
  201.   FileWriteln(Out,'   TitleBoxBorderFG = Black'  )
  202.   FileWriteln(Out,'   TitleBoxBorderBG = Grey'   )
  203.   FileWriteln(Out,'   TitleBoxInsideFG = Black'  )
  204.   FileWriteln(Out,'   TitleBoxInsideBG = Grey'   )
  205.   FileWriteln(Out,'   ClockColorFG     = Black'  )
  206.   FileWriteln(Out,'   ClockColorBG     = Grey'   )
  207.   FileWriteln(Out,'   MenuInsideFG     = Grey' )
  208.   FileWriteln(Out,'   MenuInsideBG     = Black'   )
  209.   FileWriteln(Out,'   MenuBorderFG     = White' )
  210.   FileWriteln(Out,'   MenuBorderBG     = Black'   )
  211.   FileWriteln(Out,'   MenuHeaderFG     = White'    )
  212.   FileWriteln(Out,'   MenuHeaderBG     = Black'   )
  213.   FileWriteln(Out,'   MenuVertLinesFG  = Grey'  )
  214.   FileWriteln(Out,'   MenuVertLinesBG  = Black'   )
  215.   FileWriteln(Out,'   MenuInverseFG    = Black'  )
  216.   FileWriteln(Out,'   MenuInverseBG    = Grey'    )
  217.   FileWriteln(Out,'   MenuCapColorFG   = White'  )
  218.   FileWriteln(Out,'   MenuCapColorBG   = Black'  )
  219.   FileWriteln(Out,'EndIf')
  220.   FileWriteln(Out,'' )
  221.   FileWriteln(Out,'  ;Clear the screen with a textured background' )
  222.   FileWriteln(Out,'TextColor BackGroundFG BackGroundBG' )
  223.   FileWriteln(Out,'ClearScreen 176' )
  224.   FileWriteln(Out,'')
  225.   FileWriteln(Out,'  ;Draw Status Line' )
  226.   FileWriteln(Out,'GotoXY( 1,25 ) ')
  227.   FileWriteln(Out,'TextColor( StatusLineFG,StatusLineBG ) ' )
  228.   FileWriteln(Out,'ClearLine' )
  229.   FileWriteln(Out,'WriteCenter( StatusLineText ) ')
  230.   FileWriteln(Out,'' )
  231.   FileWriteln(Out,'  ;Draw the Title Box')
  232.   FileWriteln(Out,'SingleLineBox')
  233.   FileWriteln(Out,'Explode Off')
  234.   FileWriteln(Out,'BoxInsideColor TitleBoxInsideFG TitleBoxInsideBG' )
  235.   FileWriteln(Out,'BoxBorderColor TitleBoxBorderFG TitleBoxBorderBG' )
  236.   FileWriteln(Out,'DrawBox 1 1 80 3')
  237.   FileWriteln(Out,'Write "  " + MenuTitle ')
  238.   FileWriteln(Out, '' )
  239.   FileWriteln(Out,'  ; Display the clock' )
  240.   FileWriteln(Out,'ClockColor ClockColorFG ClockColorBG')
  241.   FileWriteln(Out,'ClockPos 35 2')
  242.   FileWriteln(Out,'' )
  243.   FileWriteln(Out,'  ;Set up the blank screen message')
  244.   FileWriteln(Out,'BlankMessage "Running ' + NovellTempFileName + '"')
  245.   FileWriteln(Out,'  ;Change BlankTime to 0 if you do not want to blank the screen.' )
  246.   FileWriteln(Out,'BlankTime = 5')
  247.   FileWriteln(Out,'')
  248.   FileFlush(Out);
  249. EndProc
  250.  
  251.  
  252. ;----- Delete all spaces in a string to make them a valid MarxMenu label
  253. ;      Returns a string
  254.  
  255. Procedure DeleteSpaces( St )
  256.   While Pos( ' ',St ) > 0
  257.     Delete( St,Pos(' ',St ),1 )
  258.   EndWhile
  259.   Return St
  260. EndProc
  261.  
  262. ;----- Parse Novell Source into MenuName, MenuChoices, MenuCommands
  263.  
  264. Procedure Parse
  265. Writeln( 'Parsing Novell Menu source code ...' )
  266.   MenuPtr = 0
  267.   Loop( NumberOfElements( NovLines ) )
  268.      If left(NovLines[LoopIndex],1) = '%'
  269.         ChoicePtr = 0
  270.         CommandPtr = 0
  271.         MenuPtr = MenuPtr + 1
  272.         Tmp = mid(NovLines[LoopIndex],2,255)
  273.         X = pos(',',Tmp)
  274.         If X = 0 then X = length(Tmp) + 1
  275.         Menus[MenuPtr].MenuName = ':' + left(Tmp,X - 1)
  276.         Tmp = mid(Tmp,X + 1,255)
  277.         Menus[MenuPtr].YPos = value(NextWord(Tmp))
  278.         Menus[MenuPtr].XPos = value(NextWord(Tmp))
  279.         Menus[MenuPtr].MenuColor = value(NextWord(Tmp))
  280.      else
  281.         If left(NovLines[LoopIndex],1) > ' '
  282.            CommandPtr = 0
  283.            ChoicePtr = ChoicePtr + 1
  284.            Trim( NovLines[LoopIndex] )
  285.            If Mid( NovLines[LoopIndex], 2, 1 ) = '.'
  286.              Delete( NovLines[LoopIndex],1,2 )
  287.              Trim( NovLines[LoopIndex] )
  288.            EndIf
  289.            Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceName = NovLines[LoopIndex]
  290.         else
  291.            If ChoicePtr = 0
  292.               Writeln
  293.               Writeln 'Error in menu line: ' LoopIndex
  294.               ExitMenu
  295.            EndIf
  296.            CommandPtr = CommandPtr + 1
  297.            Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd[CommandPtr] = NovLines[LoopIndex]
  298.         EndIf
  299.      EndIf
  300.   EndLoop
  301. EndProc
  302.  
  303. ;------
  304. ;- Create the Menu Choices Array
  305. ;------
  306. Procedure WriteOutMenuChoices
  307.   Writeln('Translating: ' + mid(Menus[MenuPtr].MenuName,2,255))
  308.   FileWriteln(Out,';------' )
  309.   FileWriteln(Out,';- Translating: ' + mid(Menus[MenuPtr].MenuName,2,255))
  310.   FileWriteln(Out,';------' )
  311.   FileWriteln(Out,'')
  312.   If MenuPtr > 1
  313.     Tmp = Menus[MenuPtr].MenuName
  314.     Tmp = DeleteSpaces( Tmp )
  315.     FileWriteln(Out,Tmp)
  316.   EndIf
  317.   FileWriteln(Out,'Dispose Choices')
  318.      Loop( NumberOfElements( Menus[MenuPtr].MenuChoices ) )
  319.        FileWriteln(Out,'Choices[' + Str( LoopIndex ) + '] = " ' + Menus[MenuPtr].MenuChoices[LoopIndex].ChoiceName + '"')
  320.      EndLoop
  321.   FileWriteln(Out,'MakeBox( "' + Mid( Menus[MenuPtr].MenuName,2,255) + '",' + Str( Menus[MenuPtr].YPos ) + ',' + Str( Menus[MenuPtr].XPos ) + ',CenterXY )');
  322. EndProc
  323.  
  324. ;------
  325. ;- Create the Onkey Statements
  326. ;------
  327. Procedure WriteOutOnkeyChoices
  328.   Loop( NumberOfElements(Menus[MenuPtr].MenuChoices) )
  329.     ChoicePtr = LoopIndex
  330.     Tmp = Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceName
  331.     FileWriteln(Out,'OnKey "' + Char( 64 + ChoicePtr ) + '"')
  332.     Loop( NumberOfElements(Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd) )
  333.       CommandPtr = LoopIndex
  334.       Tmp = Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd[CommandPtr]
  335.       Trim(Tmp)
  336.       If UpperCase(Tmp) = '!LOGOUT' then Tmp = '|LogOut'
  337.       If Left( Tmp,1 ) = '%'
  338.         Tmp = DeleteSpaces( Tmp )
  339.         Tmp = '^' + Mid( Tmp,2,255 )
  340.       EndIf
  341.       If pos('@',Tmp) > 0
  342.         X = 1
  343.         while X <= length(Tmp)
  344.           while (X <= length(Tmp)) and (mid(Tmp,X,1) <> '@')
  345.              X = X + 1
  346.           endwhile
  347.           Z[1] = mid(Tmp,X,1)
  348.           Z[2] = mid(Tmp,X + 1,1)
  349.           If (Z[1] = '@') and (((Z[2] > '0') and (Z[3] <= '9')) or (Z[2] = '"'))
  350.             If Z[2] = '"'
  351.               insert(' ',Tmp,X + 1)
  352.               VarNum = 10
  353.             else
  354.               VarNum = ord(Z[2]) - 48
  355.             EndIf
  356.             InputAVar = mid(Tmp,X + 2,1) = '"'
  357.             If InputAVar
  358.               Y = X + 3
  359.               while (mid(Tmp,Y,1) <> '"') and (Y <= length(Tmp))
  360.                 Y = Y + 1
  361.               endwhile
  362.               PromptLine = mid(Tmp,X + 3,Y - (X + 3))
  363.             else
  364.               Y = X + 1
  365.             EndIf
  366.           delete(Tmp,X,Y - X + 1)
  367.           insert('%NovVar' + Str(VarNum)  ,Tmp,X)
  368.           If InputAVar
  369.             FileWriteln(Out,'   |%NovVar',Str( VarNum ), ' = ReadTextLine( "' + PromptLine + '" )')
  370.           EndIf
  371.         EndIf
  372.       endwhile
  373.     EndIf
  374.       FileWriteln(Out,'   ' + Tmp )
  375.     EndLoop
  376.     FileWriteln(Out,'')
  377.   EndLoop
  378. EndProc
  379.  
  380. ;------
  381. ;- Create the Menus
  382. ;------
  383. Procedure WriteOutMenus
  384. Var LoopCount
  385.   Writeln
  386.   LoopCount = MenuPtr
  387.   Loop( LoopCount ) ;lNumberOfElements(Menus) )
  388.      MenuPtr = LoopIndex
  389.      WriteOutMenuChoices
  390.      WriteOutOnkeyChoices
  391.      If MenuPtr = 1
  392.         FileWriteln(Out,'OnKey ESC')
  393.         FileWriteln(Out,'   ^Leave')
  394.         FileWriteln(Out,'')
  395.      EndIf
  396.   EndLoop
  397. EndProc
  398.  
  399. ;------
  400. ;- Create the support procedures
  401. ;------
  402. Procedure WriteOutProcedures
  403.   FileWriteln(Out,'')
  404.   FileWriteln(Out,';------' )
  405.   FileWriteln(Out,';- Read a Text Line Procedure' )
  406.   FileWriteln(Out,';------' )
  407.   FileWriteln(Out,'Procedure ReadTextLine( St )')
  408.   FileWriteln(Out,' Var AnswerLine' )
  409.   FileWriteln(Out,'   Dispose Choices' )
  410.   FileWriteln(Out,'   Choices[1] = "" ' )
  411.   FileWriteln(Out,'   MakeBox( "User Input",21,0,CenterXY)')
  412.   FileWriteln(Out,'   Write " " St " "')
  413.   FileWriteln(Out,'   TextColor( MenuCapColorFG,MenuCapColorBG )')
  414.   FileWriteln(Out,'   AnswerLine = Readln')
  415.   FileWriteln(Out,'   EraseTopWindow')
  416.   FileWriteln(Out,'   Return AnswerLine ' )
  417.   FileWriteln(Out,'EndProc')
  418.   FileWriteln(Out,'')
  419.  
  420.   FileWriteln(Out,';------' )
  421.   FileWriteln(Out,';- MenuExit Procedure')
  422.   FileWriteln(Out,';------' )
  423.   FileWriteln(Out,':Leave' )
  424.   FileWriteln(Out,'   Dispose Choices' )
  425.   FileWriteln(Out,'   Choices[1] = "Yes"' )
  426.   FileWriteln(Out,'   Choices[2] = "No"' )
  427.   FileWriteln(Out,'   MakeBox(" Exit ",0,0,CenterXY )' )
  428.   FileWriteln(Out,'   OnKey "A"' )
  429.   FileWriteln(Out,'      |ExitMenu' )
  430.   FileWriteln(Out,'' )
  431.   FileWriteln(Out,'   OnKey "B"' )
  432.   FileWriteln(Out,'      |LastKey = Esc' )
  433.   FileWriteln(Out,'' )
  434.  
  435.   FileWriteln(Out,';------' )
  436.   FileWriteln(Out,';- Logout Procedure' )
  437.   FileWriteln(Out,';------' )
  438.   FileWriteln(Out,'Procedure Logout' )
  439.   FileWriteln(Out,'   StuffKbd = "Logout" + CR' )
  440.   FileWriteln(Out,'   ExitMenu' )
  441.   FileWriteln(Out,'EndProc' )
  442.   FileWriteln(Out,'' )
  443.  
  444.   FileWriteln(Out,';------' )
  445.   FileWriteln(Out,';- This draws a menu similiar to the Novell menus' )
  446.   FileWriteln(Out,';- An 0 for Row And/Or Col, and the menu will get centered respectifly' )
  447.   FileWriteln(Out,';------' )
  448.   FileWriteln(Out,'Procedure MakeBox( HeaderST,Row,Col,XYOrgin )' )
  449.   FileWriteln(Out,'Var NumElem Height Width' )
  450.   FileWriteln(Out,'' )
  451.   FileWriteln(Out,'   Width = Length( HeaderSt )' )
  452.   FileWriteln(Out,'   NumElem = NumberOfElements( Choices )' )
  453.   FileWriteln(Out,'     ;Get the widest element in the Choices Array' )
  454.   FileWriteln(Out,'   If Length( Choices[1] ) > 0 ' )
  455.   FileWriteln(Out,'     Loop NumElem' )
  456.   FileWriteln(Out,'       Trim( Choices[LoopIndex] )' )
  457.   FileWriteln(Out,'       Choices[LoopIndex] = " " + Char( 64 + LoopIndex ) + ". " + Choices[LoopIndex]' )
  458.   FileWriteln(Out,'       Width = Max( Width,Length( Choices[LoopIndex] ) )' )
  459.   FileWriteln(Out,'     EndLoop' )
  460.   FileWriteln(Out,'   Else' )
  461.   FileWriteln(Out,'     Width = 72 ' )
  462.   FileWriteln(Out,'   EndIf' )
  463.   FileWriteln(Out,'   Height = NumElem + 4' )
  464.   FileWriteln(Out,'   Width = Width + 6' )
  465.   FileWriteln(Out,'   If XYOrgin = CenterXY' )
  466.   FileWriteln(Out,'     If Row = 0' )
  467.   FileWriteln(Out,'         ;Center window verticaly' )
  468.   FileWriteln(Out,'       Row = (( 25 - Height ) / 2) + 2' )
  469.   FileWriteln(Out,'     Else' )
  470.   FileWriteln(Out,'         ;Center window with X Coordinate' )
  471.   FileWriteln(Out,'       Row = (Row - (Height / 2) + 1 )' )
  472.   FileWriteln(Out,'     EndIf' )
  473.   FileWriteln(Out,'     If Col = 0' )
  474.   FileWriteln(Out,'         ;Center window horizonitly' )
  475.   FileWriteln(Out,'       Col = ( 80 - Width) / 2' )
  476.   FileWriteln(Out,'     Else' )
  477.   FileWriteln(Out,'         ;Center window with Y Coordinate' )
  478.   FileWriteln(Out,'       Col = (Col - ( Width / 2 ) + 1 )' )
  479.   FileWriteln(Out,'     EndIf' )
  480.   FileWriteln(Out,'   EndIf' )
  481.   FileWriteln(Out,'     ;Make Sure Row and Col are within their range' )
  482.   FileWriteln(Out,'   While Row <= 4' )
  483.   FileWriteln(Out,'     Row = Row + 1' )
  484.   FileWriteln(Out,'   EndWhile' )
  485.   FileWriteln(Out,'   While ((Row + Height) > 24)' )
  486.   FileWriteln(Out,'     Row = Row - 1' )
  487.   FileWriteln(Out,'   EndWhile' )
  488.   FileWriteln(Out,'   While Col <= 1' )
  489.   FileWriteln(Out,'     Col = Col + 1' )
  490.   FileWriteln(Out,'   EndWhile' )
  491.   FileWriteln(Out,'   While ((Col + Width) > 80)' )
  492.   FileWriteln(Out,'     Col = Col - 1' )
  493.   FileWriteln(Out,'   EndWhile' )
  494.   FileWriteln(Out,'   CreateXYBox( Col,Row,Width,Height,HeaderSt,NumElem )' )
  495.   FileWriteln(Out,'EndProc' )
  496.   FileWriteln(Out,'' )
  497.   FileWriteln(Out,';------' )
  498.   FileWriteln(Out,';- Draw the Box' )
  499.   FileWriteln(Out,';------' )
  500.   FileWriteln(Out,'Procedure CreateXYBox( Col,Row,Width,Height,HeaderSt,NumElem )' )
  501.   FileWriteln(Out,'     ;Draw the main window' )
  502.   FileWriteln(Out,'   Explode On' )
  503.   FileWriteln(Out,'   DoubleLineBox' )
  504.   FileWriteln(Out,'   BoxInsideColor( MenuInsideFG,MenuInsideBG )' )
  505.   FileWriteln(Out,'   BoxBorderColor( MenuBorderFG,MenuBorderBG )' )
  506.   FileWriteln(Out,'   DrawBox( Col, Row, Width, Height )' )
  507.   FileWriteln(Out,'     ;Write the header' )
  508.   FileWriteln(Out,'   TextColor( MenuHeaderFG,MenuHeaderBG )' )
  509.   FileWriteln(Out,'   WriteCenter( HeaderSt )' )
  510.   FileWriteln(Out,'     ;Write the vertical lines' )
  511.   FileWriteln(Out,'   TextColor( MenuVertLinesFG,MenuVertLinesBG )' )
  512.   FileWriteln(Out,'   Writeln' )
  513.   FileWriteln(Out,'   ClearLine 196' )
  514.   FileWriteln(Out,'   GotoXY 2 2' )
  515.   FileWriteln(Out,'   WriteVertical mid(VertLine,1,Height - 3)' )
  516.   FileWriteln(Out,'     ;Draw the menu text box' )
  517.   FileWriteln(Out,'   If Choices[1] > "" ' )
  518.   FileWriteln(Out,'     CapsColor( MenuCapColorFG,MenuCapColorBG )' )
  519.   FileWriteln(Out,'   Else' )
  520.   FileWriteln(Out,'     CapsColor( Black,Black ) ' )
  521.   FileWriteln(Out,'   EndIf ' )
  522.   FileWriteln(Out,'   InverseColor( MenuInverseFG,MenuInverseBG )' )
  523.   FileWriteln(Out,'   Explode Off' )
  524.   FileWriteln(Out,'   NoBoxBorder' )
  525.   FileWriteln(Out,'   Window( Col + 3, Row + 3, Width - 4, Height - 4 )' )
  526.   FileWriteln(Out,'    ;Write the menu choices' )
  527.   FileWriteln(Out,'   Loop( NumElem - 1 )' )
  528.   FileWriteln(Out,'     Writeln( Choices[LoopIndex] )' )
  529.   FileWriteln(Out,'   EndLoop' )
  530.   FileWriteln(Out,'   Write Choices[NumElem]' )
  531.   FileWriteln(Out,'   UseArrows On' )
  532.   FileWriteln(Out,'EndProc ' )
  533.   FileClose(Out)
  534. EndProc
  535.